import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QMessageBox, QDialog, QPushButton

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.setWindowTitle("My App")

        button = QPushButton("Press me for message box")
        button.clicked.connect(self.button_clicked)

        self.setCentralWidget(button)

    def button_clicked(self, s):
        print("button is clicked: ", s)

        dlg = QMessageBox(self)
        dlg.setWindowTitle("I hava a question!")
        dlg.setText("Ths is a simple dialog")
        button = dlg.exec()

        if button == QMessageBox.Ok:
            print("OK was pressed")

app = QApplication(sys.argv)

window = MainWindow()
window.show()

app.exec()
